package Day014_Lambda表达式_Stream流.ZuoYe.Test3;

import java.util.Arrays;

/**
 * @author zhangyan
 * @date 2020/5/5 17:46
 */
public class Test3 {
    public static void main(String[] args) {

        //创建数组存储学生信息
        Student s1 = new Student("张三", 80);
        Student s2 = new Student("李四", 90);
        Student s3 = new Student("王五", 78);
        Student s4 = new Student("赵六", 82);

        Student[] arr = {s1,s2,s3,s4};
        //打印未排序时数组
        System.out.println(Arrays.toString(arr));

        //排序,Lambda省略格式
        Arrays.sort(arr,(e1,e2)->e2.getGrade() - e1.getGrade());
        //打印数组
        System.out.println(Arrays.toString(arr));

    }
}
